//package com.mall.shopping.services;
//
//
//import com.mall.shopping.constants;
//import com.mall.shopping.IProductService;
//import com.mall.shopping.constants.ShoppingRetCode;
//import com.mall.shopping.converter.ContentConverter;
//import com.mall.shopping.converter.ProductConverter;
//import com.mall.shopping.dal.entitys.Item;
//import com.mall.shopping.dal.entitys.Panel;
//import com.mall.shopping.dal.entitys.PanelContentItem;
//import com.mall.shopping.dal.persistence.ItemMapper;
//import com.mall.shopping.dal.persistence.PanelContentMapper;
//import com.mall.shopping.dal.persistence.PanelMapper;
//import com.mall.shopping.dto.*;
//import com.mall.shopping.utils.ExceptionProcessorUtils;
//import lombok.extern.slf4j.Slf4j;
//import org.apache.dubbo.config.annotation.Service;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//
//import java.util.HashSet;
//import java.util.List;
//import java.util.Set;
//
//@Slf4j
//@Component
//@Service
//public class ProductServiceImpl implements IProductService {
//
//    @Autowired
//    ItemMapper itemMapper;
//
//    @Autowired
//    PanelMapper panelMapper;
//
//    @Autowired
//    PanelContentMapper panelContentMapper;
//
//    @Autowired
//    ProductConverter productConverter;
//
//    @Autowired
//    ContentConverter contentConverter;
//
//
//    @Override
//    public ProductDetailResponse getProductDetail(ProductDetailRequest request) {
//        return null;
//    }
//
//    @Override
//    public AllProductResponse getAllProduct(AllProductRequest request) {
//        AllProductResponse allProductResponse = new AllProductResponse();
//        try {
//            request.requestCheck();
//
//            List<Item> itemList = itemMapper.selectItemFront(request);
//            List<ProductDto> productDtoList = productConverter.items2Dto(itemList);
//
//            allProductResponse.setProductDtoList(productDtoList);
//            allProductResponse.setTotal(new Long(productDtoList.size()));
//            allProductResponse.setCode(ShoppingRetCode.SUCCESS.getCode());
//            allProductResponse.setMsg(ShoppingRetCode.SUCCESS.getMessage());
//        } catch (Exception e) {
//            log.error("ProductServiceImpl.getAllProduct occur Exception :" + e);
//            ExceptionProcessorUtils.wrapperHandlerException(allProductResponse, e);
//        }
//        return allProductResponse;
//
//    }
//
//    @Override
//    public RecommendResponse getRecommendGoods() {
//        RecommendResponse recommendResponse = new RecommendResponse();
//        try {
//            Panel panel = panelMapper.selectPanelByName("热门推荐");
//            Integer panelId = panel.getId();
//            List<PanelContentItem> panelContentItemList = panelContentMapper.selectPanelContentAndProductWithPanelId(panelId);
//
//            PanelDto panelDto = contentConverter.panen2Dto(panel);
//            List<PanelContentItemDto> panelContentItemDtoList = contentConverter.panelContentItem2Dto(panelContentItemList);
//            panelDto.setPanelContentItems(panelContentItemDtoList);
//
//            //TODO 参考一下别人的代码
//            Set<PanelDto> panelDtoSet = new HashSet<>();
//            panelDtoSet.add(panelDto);
//
//            recommendResponse.setPanelContentItemDtos(panelDtoSet);
//            recommendResponse.setCode(ShoppingRetCode.SUCCESS.getCode());
//            recommendResponse.setMsg(ShoppingRetCode.SUCCESS.getMessage());
//
//        } catch (Exception e) {
//            log.error("ProductServiceImpl.getRecommendGoods occur Exception :" + e);
//            ExceptionProcessorUtils.wrapperHandlerException(recommendResponse, e);
//        }
//        return recommendResponse;
//    }
//
//
//}
